package com.tps.cloud.system.controller;

import com.tps.cloud.response.Result;
import com.tps.cloud.system.dto.SystemTenantDto;
import com.tps.cloud.system.service.SystemTenantService;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 租户管理 前端控制器
 */
@RestController
@AllArgsConstructor
@RequestMapping("/system/tenant")
public class SystemTenantController {

    private final SystemTenantService systemTenantService;

    @PostMapping
    @Operation(summary = "创建租户")
    public Result<Long> save(@Valid @RequestBody SystemTenantDto systemTenantDto) {
        Long tenantId=systemTenantService.createTenant(systemTenantDto);
        return Result.ok(tenantId);
    }
}
